package com.itheima;

import static java.lang.System.*;

import com.itheima.domain.Order;
import com.itheima.service.OrderService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        //TODO:加载Spring容器,从容器中获取OrderService对象完成根据订单ID查询订单信息并把结果打印到控制台
        //1.创建核心类对象  关联核心配置文件
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        //2.从IOC 容器中获取OrderService对象
        OrderService service = (OrderService) context.getBean("orderService");
        //3.使用接口调用方法
        //根据订单ID查询订单信息并把结果打印到控制台
        Order byId = service.findById(1);
        out.println("byId = " + byId);
    }
}